import React, { Component } from 'react';
import MyGoodsLeft from './MyGoodsLeft';
import MyGoodsRight from './MyGoodsRight';
import { Level_list } from '../../utils/api';
class MyGoodlist extends Component {
  constructor(props) {
    super(props)
    this.state = {
      googslist: [],
      currentindex: 0,
      id: 0,
    }
  }
  componentDidMount() {
    Level_list().then((res) => {
      this.setState({
        googslist: res.data.list,
        id: res.data.list[0].id
      })
    })
  }
  handeclick = (index, id) => {
    console.log(id, 66666);
    this.setState({
      currentindex: index,
      id
    })
  }
  render() {
    return (
      <div className='mainlist'>
        <MyGoodsLeft list={this.state.googslist} currentindex={this.state.currentindex}
          handeclick={this.handeclick}></MyGoodsLeft>
        <MyGoodsRight id={this.state.id}></MyGoodsRight>
      </div>
    );
  }
}

export default MyGoodlist;